package com.enki.cigarettes.repository;

import com.enki.cigarettes.entity.UserT;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * @author WCS.Wang
 * @version V1.0
 * @Package com.enki.cigarettes.repository
 * @Name e-cigarettes-shop-api-module
 * @Description: TODO 用户数据层
 * @date 2019-07-19
 */
public interface UserTRepository extends PagingAndSortingRepository<UserT, String> {

    UserT findOneById(String id);

    // 邀请码
    UserT findOneByInvitationCode(String invitationCode);

    // openid
    UserT findOneByOpenid(String id);

    // openid、来源
    UserT findOneByOpenidAndUserSource(String id, int userSource);

    // 手机号、用户类型
    UserT findFirstByPhoneAndUserSource(String phone, int userSource);

    // 邀请码
    List<UserT> findByInviteeCode(String inviteeCode);
}
